/*
 * Created on Apr 15, 2005
 */
package com.scalar.chiptrack.operations.shippingRequest.forms;

import com.scalar.chiptrack.ChipTrackActionForm;
import com.scalar.chiptrack.operations.shippingRequest.ShippingRequest;
import com.scalar.chiptrack.operations.shippingRequest.ShippingRequestLot;
import org.apache.struts.action.ActionMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;

public class ShippingRequestForm extends ChipTrackActionForm
{
    private ShippingRequest mShippingRequest = new ShippingRequest();

    public ShippingRequest getShippingRequest()
    {
        return mShippingRequest;
    }

    public void setShippingRequest(ShippingRequest shippingRequest)
    {
        this.mShippingRequest = shippingRequest;
    }

    public void reset( ActionMapping mapping, HttpServletRequest request )
    {
        if( mShippingRequest == null )
        {
            mShippingRequest = new ShippingRequest();
        }
        ArrayList lotList = mShippingRequest.getLotList();
        int lotListSize = lotList != null ? lotList.size() : 0 ;
        for (int i = 0; i < lotListSize; i++)
        {
            ShippingRequestLot shippingRequestLot = (ShippingRequestLot) lotList.get(i);
            shippingRequestLot.setChecked( false );
            shippingRequestLot.setPulledQty( 0 );
        }
    }

}